package live.job;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import live.common.Log4jXmlConfig;
import live.common.ServerListener;
import live.hotel.dao.job.HotelBaseQuery;

import org.apache.commons.logging.Log;
import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class HotelBaseJob implements Job {
	private Logger log = Log4jXmlConfig.getInstance().returnLogger(HotelBaseJob.class);
	static 	String[] hotCitys={"PEK","SHA","CAN","SZX","HGH","CTU","NKG","CKG"};
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		// TODO Auto-generated method stub
		try
	    {
			Executor executor = Executors.newScheduledThreadPool(8);
	      for (int i = 0; i < hotCitys.length; i++) {
	    	  executor.execute(new HotelBaseQuery(hotCitys[i]));  
	      }
	    }
	    catch (Exception e) {
	    	log.error("酒店任务调度出错"+e.getMessage());
	    	e.printStackTrace();
	    }finally{
	    	 Executors.defaultThreadFactory();
	    }
	}

}
